package com.zyk.scaffold.seata.order.business.order.controller;

import com.zyk.scaffold.core.domain.Result;
import com.zyk.scaffold.seata.order.business.order.pojo.request.OrderRequest;
import com.zyk.scaffold.seata.order.business.order.service.OrderService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/order")
public class OrderController {

    @Autowired
    private OrderService orderService;

    @PostMapping("/ok")
    public Result<Boolean> ok(@RequestBody OrderRequest orderRequest){
        return Result.ok(orderService.ok(orderRequest));
    }

    @PostMapping("/error")
    public Result<Boolean> error(@RequestBody OrderRequest orderRequest){
        return Result.ok(orderService.error(orderRequest));
    }

    @PostMapping("/none_seata_ok")
    public Result<Boolean> none_seata_ok(@RequestBody OrderRequest orderRequest){
        return Result.ok(orderService.none_seata_ok(orderRequest));
    }

    @PostMapping("/none_seata_error")
    public Result<Boolean> none_seata_error(@RequestBody OrderRequest orderRequest){
        return Result.ok(orderService.none_seata_error(orderRequest));
    }
}
